{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "aa48f6bc-cf5d-4661-afc1-1b93293f1f96",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/search-a-2d-matrix\n",
    "\n",
    "\n",
    "Runtime: 44 ms, faster than 64.91% of Python3 online submissions for Search a 2D Matrix.\n",
    "Memory Usage: 14.7 MB, less than 84.80% of Python3 online submissions for Search a 2D Matrix.\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:\n",
    "        #6:40\n",
    "        first_column = list(zip(*matrix))[0]\n",
    "        for index, num in enumerate(first_column):\n",
    "            if index+1 < len(first_column):\n",
    "                if (target>=num and target<first_column[index+1] and index <len(first_column)):\n",
    "                    if target in matrix[index]:\n",
    "                        return True\n",
    "                    else:\n",
    "                        return False\n",
    "            else:\n",
    "                if target in matrix[-1]:\n",
    "                    return True\n",
    "                else:\n",
    "                    return False\n",
    "       #6:49\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b80f1831-0994-4bf3-9586-91b73d25f4b7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
